import requests
import execjs
js = execjs.compile(open('号角网sha1.js', encoding='utf-8').read()).call('get_header')
print(js)
headers = {
    'accept': '*/*',
    'accept-language': 'zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6',
    'authorization': 'Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE3NDYxMjE0OTYsInVpZCI6ODA2NDg3fQ.73PfK0KSHlUEpPFxYmXS0ynIO0fZ-ct-ijYiSxjhvU8',
    'content-type': 'application/json',
    'origin': 'https://web.haojiao.cc',
    'priority': 'u=1, i',
    'referer': 'https://web.haojiao.cc/',
    'sec-ch-ua': '"Microsoft Edge";v="135", "Not-A.Brand";v="8", "Chromium";v="135"',
    'sec-ch-ua-mobile': '?0',
    'sec-ch-ua-platform': '"Windows"',
    'sec-fetch-dest': 'empty',
    'sec-fetch-mode': 'cors',
    'sec-fetch-site': 'same-site',
    'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/135.0.0.0 Safari/537.36 Edg/135.0.0.0',
    'x-hj-nonce': str(js[1]),
    'x-hj-os': 'web',
    'x-hj-sign': str(js[2]),
    'x-hj-timestamp':str(js[0]),
    'x-hj-version': '1.51.44',
}

json_data = {
    'series_id': 'yljVkE6WWCH6r3h4',
    'series_tag': '2025',
    'tournament_id': [
        'ZSlLKHlD3OmdVfyj',
        'y6Dm3c7nkBysaWPG',
    ],
}

response = requests.post('https://api.haojiao.cc/wiki/api/v1/tournament/get_valorant_stats', headers=headers, json=json_data)
print(response.json())

# Note: json_data will not be serialized by requests
# exactly as it was in the original request.
#data = '{"series_id":"yljVkE6WWCH6r3h4","series_tag":"2025","tournament_id":["ZSlLKHlD3OmdVfyj","y6Dm3c7nkBysaWPG"]}'
#response = requests.post('https://api.haojiao.cc/wiki/api/v1/tournament/get_valorant_stats', headers=headers, data=data)